//
//  SegueAnimationRightToLeft.m
//  EcmDoctor
//
//  Created by 张进 on 15/7/2.
//  Copyright (c) 2015年 张进. All rights reserved.
//

#import "SegueAnimationHFlip.h"

@implementation SegueAnimationHFlip


- (void)perform

{
    UIViewController *source = self.sourceViewController;
    UIViewController *destination = self.destinationViewController;
    
    //由于加载主页面需要时间，加载其本身是自下向上的动画，但时间较短，为了不展示内部动画过程，采用卡片翻转的动画方式
    [destination setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
    
    [source presentViewController:destination animated:YES completion:^{
        //[source viewDidDisappear:YES];
        
        //[self performSelector:@selector(releaseSource:) withObject:source afterDelay:1.0f];
    }];
    [source dismissViewControllerAnimated:NO completion:nil];
}

-(void)releaseSource:(UIViewController *)source{
    [source dismissViewControllerAnimated:NO completion:nil];
}

@end
